package org.demo.controller;

import org.demo.common.Result;
import org.demo.entity.Community;
import org.demo.entity.Housewear;
import org.demo.service.ICommunityService;
import org.demo.service.IHousewearService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//小区表
@RestController
@RequestMapping("/community")
public class CommunityConteoller {
    @Autowired
    private ICommunityService communityService;
    @PostMapping("/add")
    public Result add(@RequestBody Community community){
        communityService.add(community);
        return Result.success();
    }
    @GetMapping("/list")
    public Result<List<Community>> list(@RequestBody (required = false) Community community){
        List<Community> list= communityService.list(community);
        return Result.success(list);
    }
    @PutMapping("/update")
    public Result update(@RequestBody Community community){
        communityService.update(community);
        return Result.success();
    }
    @DeleteMapping("/delete")
    public  Result delete(String id){
        communityService.delete(id);
        return Result.success();
    }

}
